/*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
package com.qihoo.gamecenter.sdk.suspend.b.b;

import android.content.Context;
import android.os.RemoteException;
import com.qihoo.gamecenter.sdk.suspend.b.c;
import com.qihoo.gamecenter.sdk.suspend.b.c.a;
import com.qihoo.gamecenter.sdk.suspend.b.e.j;
import com.qihoo.gamecenter.sdk.suspend.remote.QRemoteService;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class h {
    private static final f a = g.a();
    private static final List b = new ArrayList();

    public static a a(Context paramContext, String paramString, Map paramMap, d paramd) {
        a locala = new a(paramContext, paramString, paramd);
        locala.execute(new Map[] { paramMap });
        return locala;
    }

    public static e a(Context paramContext, String paramString, Map paramMap) {
        if (paramString == null)
            return null;
        ArrayList localArrayList = new ArrayList();
        if (paramMap != null) {
            localObject = paramMap.keySet().iterator();
            while (((Iterator) localObject).hasNext()) {
                str1 = (String) ((Iterator) localObject).next();
                b(localArrayList, str1, (String) paramMap.get(str1));
            }
        }
        a(localArrayList);
        String str1 = c.a();
        Object localObject = c.a(paramString, localArrayList, null, null, str1);
        String str2 = "";
        try {
            str2 = QRemoteService.a().a(com.qihoo.gamecenter.sdk.suspend.remote.b.b().c());
        } catch (RemoteException localRemoteException) {
            localRemoteException.printStackTrace();
        }
        com.qihoo.gamecenter.sdk.suspend.b.b.a("HttpUtils", "curPkgName:"
                + com.qihoo.gamecenter.sdk.suspend.remote.b.b().c());
        com.qihoo.gamecenter.sdk.suspend.b.b.a("HttpUtils", "cookie = " + str2);
        String str3 = a.a(paramContext, (String) localObject, str2, str1);
        str3 = c.a(str3, str1);
        com.qihoo.gamecenter.sdk.suspend.b.b.a("HttpUtils", "Http get result = " + str3);
        if (str3 == null)
            return null;
        return ((e) new e(str3));
    }

    public static e a(Context paramContext, String paramString, Map paramMap1, Map paramMap2) {
        if (paramString == null)
            return null;
        ArrayList localArrayList1 = new ArrayList();
        a(localArrayList1);
        if (paramMap1 != null) {
            localObject2 = paramMap1.keySet().iterator();
            while (((Iterator) localObject2).hasNext()) {
                localObject1 = (String) ((Iterator) localObject2).next();
                b(localArrayList1, (String) localObject1, (String) paramMap1.get(localObject1));
            }
        }
        Object localObject1 = new ArrayList();
        if (paramMap2 != null) {
            localObject3 = paramMap2.keySet().iterator();
            while (((Iterator) localObject3).hasNext()) {
                localObject2 = (String) ((Iterator) localObject3).next();
                b((List) localObject1, (String) localObject2, (String) paramMap2.get(localObject2));
            }
        }
        Object localObject2 = c.a();
        Object localObject3 = c.b(paramString, localArrayList1, (List) localObject1, null, (String) localObject2);
        String str1 = null;
        String str2 = paramString;
        if ((localObject3 != null) && (2 == ((List) localObject3).size())) {
            str2 = ((c.a) ((List) localObject3).get(0)).b();
            str1 = ((c.a) ((List) localObject3).get(1)).b();
        }
        ArrayList localArrayList2 = new ArrayList();
        c(localArrayList2, "signid", str1);
        if (paramMap2 != null) {
            Iterator localIterator = paramMap2.keySet().iterator();
            while (localIterator.hasNext()) {
                str3 = (String) localIterator.next();
                c(localArrayList2, str3, (String) paramMap2.get(str3));
            }
        }
        String str3 = "";
        try {
            str3 = QRemoteService.a().a(com.qihoo.gamecenter.sdk.suspend.remote.b.b().c());
        } catch (RemoteException localRemoteException) {
            localRemoteException.printStackTrace();
        }
        String str4 = a.a(paramContext, localArrayList2, str2, str3);
        str4 = c.a(str4, (String) localObject2);
        com.qihoo.gamecenter.sdk.suspend.b.b.a("HttpUtils", "Http post result = " + str4);
        if (str4 == null)
            return null;
        return ((e) (e) (e) new e(str4));
    }

    public static String a(Context paramContext, String paramString, List paramList) {
        if (paramString == null)
            return null;
        String str = a.a(paramContext, paramList, paramString, null);
        com.qihoo.gamecenter.sdk.suspend.b.b.a("HttpUtils", "Http post result = " + str);
        return str;
    }

    public static void a(List paramList) {
        if (paramList == null)
            paramList = new ArrayList();
        b(paramList, "nonce", c.c());
        b(paramList, "clienttype", "gameunion");
    }

    public static void a(List paramList, String paramString1, String paramString2) {
        if (paramString2 == null)
            return;
        j localj = new j();
        localj.a(paramString1);
        localj.b(paramString2);
        paramList.add(localj);
    }

    public static void b(List paramList, String paramString1, String paramString2) {
        if (paramString2 == null)
            return;
        paramList.add(new c.a(paramString1, paramString2));
    }

    private static void c(List paramList, String paramString1, String paramString2) {
        if (paramString2 == null)
            return;
        paramList.add(new i(paramString1, paramString2));
    }
}